# This is an interface to haplo parser
# Every haplo parser should inherite from this class
# and implement parseOutput and parseAlleles
package IOutputParser;
use Class::Struct;
use strict;

# This struct contains 2 values.
# It represents the alleles/labels for specific person and specific marker
struct CellData =>[
	val1 => '$', 
	val2 => '$',
];

#constructor
sub new {
    my ($class) = @_;	

    my $self ={ };
    bless $self, $class;
    return $self;
}
# Abstract function- parse the tool's output file
#Input: dat wrapper, name of the output file, list of markers in current window, number of family to parse
sub parseOutput{
	my ($self, $datWrapper, $pedWrapper, $outputFile, $currentMarkers, $currFamily) = @_;
	die "oops, parseOutput is an abstract method that should be implemented in a subclass" ;
}

# Abstract function- parse the tool's alleles file
#Input: name of the alleles file 
sub parseAlleles{
	my ($self, $allelesFile) = @_;
	die "oops, parseAlleles is an abstract method that should be implemented in a subclass" ;
}

# Add a label cellData (called by the actual parsers during the parsing)
# Input: the cell data, it's person, it's specific marker
sub addLabelCell{
    my ($self, $cellData, $personNum, $markerName) = @_;	
	
	$self->{LABEL}{$personNum}{$markerName} = $cellData;
}

# Get a label cellData (called by the HaplotypeWrapper, in order to draw the cell)
# Input: a person, a specific marker
sub getLabelCell{
    my ($self, $personNum, $markerName) = @_;	
	return $self->{LABEL}{$personNum}{$markerName};
}

# Add an allele cellData (called by the actual parsers during the parsing)
# Input: the cell data, it's person, it's specific marker
sub addAlleleCell{
    my ($self, $cellData, $personNum, $markerName) = @_;	
	$self->{ALLELE}{$personNum}{$markerName} = $cellData;
}

# Get an allele cellData (called by the HaplotypeWrapper, in order to draw the cell)
# Input: a person, a specific marker
sub getAlleleCell{
    my ($self, $personNum, $markerName) = @_;	
	return $self->{ALLELE}{$personNum}{$markerName};
}

1;